Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on #3706 I discovered literal patterns weren't being lowered. This PR implements that lowering.
Questions for reviewers:
ast::LiteralKindtoLiteral, butast::LiteralKinddoesn't include information about the actual value of the literal, which causesLiteralto be created with the default value for the type (rather than the actual value in the source code). Am I correct in thinking that we'd eventually want to change things in such a way that we could initialize theLiteralwith the actual literal value? Is there an existing issue for this, or else perhaps I should create one to discuss how it should be implemented? My main question would be whetherast::LiteralKindshould be extended to hold the actual value, or if we should provide some other way to get that information fromast::Literal?lit.literal()returns anOption. Is returning aPat::Missingin theNonecase the right thing to do?ast::Pat::LiteralPattoPat::Lit. I don't have an immediate question here, but I just wanted to ensure this section is looked at closely during review.